home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1992-07-02 | 4.1 KB | 101 lines |
- (* Windows BIOS Windows 1992 Chris Harshman
- This module of procedures was designed to be able to use Fitted Software
- Tools Modula-2 Compiler to handle the screen with pop up windows using
- BIOS interupts. They allow one to specify window color, have the cursor
- stay within current window boundaries, and use fast routines that take up
- less space in your executable .EXE file. Standard Modula-2 string format
- is used. NOTE: These routines do little error checking, so be carefull
- what values are entered. These routines should not crash your program
- though. Any user input should be checked by you, the programmer before
- sending it to these routines. *)
-
- DEFINITION MODULE Windows;
-
- FROM Screen IMPORT ScreenData;
-
- (* Before calling any of these routines, it is suggested to use the procedures
- from text for setting the screen mode and main screen colors if text is
- to be printed outside of any windows. *)
-
- TYPE Title = ARRAY[0..39] OF CHAR;
- Window = RECORD
- t,b,l,r,fc,bc:CARDINAL;
- ttl:Title;
- dat:ScreenData;
- END;
-
- PROCEDURE Clw;
- (* Clears the current window. Uses color set by MakeWindow Procedure. *)
-
- PROCEDURE WSetCursor(v, h:CARDINAL);
- (* Sets the cursor to verticle row (from 0 to height), horizontal column
- (from 0 to width) of the current window. *)
-
- PROCEDURE MakeWindow(v, h, height, width, fcolor, bcolor:CARDINAL;
- title:Title; VAR w:Window);
- (* Defines a window to later be put on the screen with SetWindow. Refers
- v and h to the upper left coordinates inside the window, so leave room
- for a 1 character border arround the window. *)
-
- PROCEDURE PutWindow(VAR w:Window);
- (* Writes the window frame and title, clears the window, and sets it as the
- current window. *)
-
- PROCEDURE SetWindow(VAR w:Window);
- (* Sets the window referenced by w on the screen as the current window. It
- is recommended to call PutWindow before calling this procedure the first
- time for a window. *)
-
- PROCEDURE RemoveWindow(VAR w:Window);
- (* Removes window referenced by w from the screen. You the programmer must
- call SetWindow to change the current window. *)
-
- PROCEDURE ScrollUp(count:CARDINAL);
- PROCEDURE ScrollDown(count:CARDINAL);
- (* Will scroll the current window up or down the specified number of rows.
- setting count to 0 will clear the current window. *)
-
-
-
- (* All Read and Write routines will print in the colors specified by the
- MakeWindow procedure. *)
-
- PROCEDURE WRead(VAR ch:CHAR);
- (* Reads one character from the keyboard using BIOS calls. *)
-
-
- (* ReadCard and ReadInt will give unpredictable results if a number
- outside the ranges of the type are entered. *)
- PROCEDURE WReadCard(VAR n:CARDINAL);
- (* Reads a cardinal number from the keyboard. If a non-number character is
- entered in the input, it is ignored. (ex enter a1, the a is ignored) *)
-
- PROCEDURE WReadInt(VAR i:INTEGER);
- (* Reads an integer number from the keyboard. If a non-number character
- besides a leading - is entered, it is ignored. *)
-
- PROCEDURE WReadString(VAR str:ARRAY OF CHAR);
- (* Reads str from the keyboard using BIOS calls. *)
-
- PROCEDURE WWrite(ch:CHAR);
- (* Writes ch in the current window BIOS calls. *)
-
- PROCEDURE WWriteCard(n, lngth:CARDINAL);
- (* Writes n in a field of Length lngth. lngth must be at least the length
- of the number to be printed or the leftmost numbers will be cut off.
- The length can be up to 10. *)
-
- PROCEDURE WWriteInt(n:INTEGER; lngth:CARDINAL);
- (* Writes n in a field of Length lngth. lngth must be at least the length
- of the number to print or the leftmost numbers and/or sign are cut off.
- The length can be up to 10. *)
-
- PROCEDURE WWriteString(str:ARRAY OF CHAR);
- (* Writes str to the current window using BIOS calls. *)
-
- PROCEDURE WWriteLn;
- (* Does a carriage return and linefeed, puts cursor on begining of next
- line as defined by the window coordinates. *)
-
- END Windows.